package com.spring.listener;

import com.alibaba.fastjson.JSON;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

public class RunListener implements SpringApplicationRunListener {

    public RunListener(SpringApplication application, String[] args) {
        System.out.println("init...." + application);
    }



    public void starting() {
        System.out.println("run start.........................");
    }

    public void environmentPrepared(ConfigurableEnvironment environment) {
        System.out.println("run environmentPrepared " + environment);
    }

    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("run contextPrepared " + context);
    }

    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("run contextLoaded " + context);
    }

    public void started(ConfigurableApplicationContext context) {

        System.out.println("run started " + context);
    }

    public void running(ConfigurableApplicationContext context) {

        System.out.println("run running " + context);
    }

    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        System.out.println("run failed " + context);
    }
}
